let mongoose = require('mongoose');
let userSchema = new mongoose.Schema({
    "userId":String,
    "userName":String,
    "userPwd":String,
    "orderList":[
        {
            "orderId":String,
            "orderTotal":Number,
            "addressInfo":{
                "addressId":String,
                "userName":String,
                "streetName":String,
                "postCode":String,
                "tel":String,
            },
            "goodsList":[ 
                {
                    "productImage":String,
                    "salePrice":String,
                    "productName":String,
                    "productId":String,
                    "productNum":String,
                }
            ],
            "orderStatus":String,
            "createDate":String
        }
    ],
    "cartList":[
        {
            "productId":String,
            "productName":String,
            "salePrice":Number,
            "productImage":String,
            "productNum":String,
            "checked":Boolean,
        }
    ],
    "addressList":[
        {
            "addressId":String,
            "userName":String,
            "streetName":String,
            "postCode":String,
            "tel":String,
            "isDefault":Boolean
        }
    ],
});

module.exports = mongoose.model('User', userSchema);